<?php

namespace Modules\Admin\Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use Modules\Admin\Entities\Admin;
use Spatie\Permission\Models\Role;

class AdminTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();
        factory (Admin::class,1)->create();
        $admin=Admin::first();
        $admin->name='admin';
		$admin->nickname='后台管理员';
		$admin->password=bcrypt('admin888');
		$admin->save();
		Role::create ([
			'name'=>'webmaster',
			'title'=>'网站站长',
			'guard_name'=>'admin'
		]);
		$admin->syncRoles('webmaster');
    }
}
